package com.huonan.component.web.service;

import com.huonan.component.mysql.TBDictonaryRepository;
import com.huonan.component.mysql.TbDictionary;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
@AllArgsConstructor
public class WebService {

    private TBDictonaryRepository repository;

    public long count() {
        return repository.count();
    }

    public TbDictionary selectById(int id) {
        return repository.findById(id).orElseGet(null);
    }

    public List<TbDictionary> selectByName(String name) {
        return repository.findByName(name);
    }

    public List<TbDictionary> selectListById(int id) {
        return repository.findListById(id);
    }

    public Integer exception() {
        return 1;
    }
}
